import http from '@/Services/Request'

const base = '/api/Messages'

export default {
    /** 获取所有消息 */
    GetAll() {
        return http.get(base)
    },

    /** 根据ID获取消息 */
    GetById(id) {
        return http.get(`${base}/${id}`)
    },

    /** 创建消息 */
    Create(model) {
        return http.post(base, model)
    },

    /** 更新消息 */
    Update(id, model) {
        return http.put(`${base}/${id}`, model)
    },

    /** 删除消息 */
    Delete(id) {
        return http.delete(`${base}/${id}`)
    },

    /** 获取用户的消息 */
    GetUserMessages(userId) {
        return http.get(`${base}/user/${userId}`)
    },

    /** 获取用户未读消息数量 */
    GetUnreadCount(userId) {
        return http.get(`${base}/user/${userId}/unread`)
    },

    /** 标记消息为已读 */
    MarkAsRead(id) {
        return http.put(`${base}/${id}/read`)
    }
} 